import { Random, mock } from 'mockjs';

export default {
  'GET /api/project': mock({
    'data|30': [
      {
        projectId: '@id',
        key: '@id',
        groupId: '@id',
        projectName: '@cname',
        projectType: `@pick(['ssr','spa','microService'])`,
        projectGitUrl: `@url('github')`,
        envLocation: [
          {
            env: 'dev',
            host: `@url('http')`,
            path: `@word(0,5)`,
            sub: `@word(0,3)`,
          },
          {
            env: 'fat',
            host: `@url('http')`,
            path: `@word(0,5)`,
            sub: `@word(0,3)`,
          },
          {
            env: 'sit',
            host: `@url('http')`,
            path: `@word(0,5)`,
            sub: `@word(0,3)`,
          },
          {
            env: 'prod',
            host: `@url('http')`,
            path: `@word(0,5)`,
            sub: `@word(0,3)`,
          },
        ],
        createTime: `@datetime`,
        rewrite: `@pick([true, false])`,
      },
    ],
  }),
  'GET /api/group': mock({
    'data|8': [
      {
        groupId: '@id',
        groupName: '@name(2,3)',
      },
    ],
  }),
  'POST /api/project': {
    data: null,
    message: 'success',
  },
  'DELETE /api/project': {
    data: null,
    message: 'success',
  },
  'GET /api/iteration': mock({
    'data|8': [
      {
        projectId: '@id',
        iterativeId: '@id',
        iterativeName: '@cname',
        iterativeEnv: `@pick(['dev','fat','sit','prod'])`,
        iterativeStatus: `@pick([0,1,2])`,
        branch: '@first',
        iterativeRemark: '@csentence',
      },
    ],
  }),
  'POST /api/iteration': mock({
    data: null,
    message: 'success',
  }),
  'DELETE /api/iteration': mock({
    data: null,
    message: 'success',
  }),
  'POST /api/app/envlocation': mock({
    data: null,
    message: 'success',
  }),
};
